package com.central.dataManage.service;

import com.central.common.enums.DbType;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.common.service.ISuperService;
import com.central.common.model.DatasourceInfo;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author Tindy
 * @date 2021/7/5
 * @describe
 */
public interface IDatasourceService extends ISuperService<DatasourceInfo> {
    Result saveOrUpdateDatasource(DatasourceInfo datasourceInfo) throws Exception;

    PageResult<DatasourceInfo> findDatasources(Map<String, Object> params);

    void delById(Long id);

    boolean connTest(DatasourceInfo datasourceInfo);

    boolean synch(Long id) throws SQLException;

    List<Map<String,Object>> datasourcesByType(DbType type);

    Result createUserDatabase(String username) throws SQLException;

    Result createProDatabase(String proName) throws SQLException, IOException;

    Result setDbSize(String username, String proName, Long size) throws SQLException;

    List<DbType> findAllDbTypes();

    DatasourceInfo findSysDatasource();

    Result createUserRoleOfHive(String proName, String username) throws SQLException;

    Result createUserHdfsHomeDir(String proName, String username) throws IOException;
}